< previous page page_51 next page >

Page 51
Drag. Handles the operation of the users' dragging and dropping the object within its container
Move. Changes the position of an object
SetFocus. Gives focus to the specified control
Zorder. Determines whether an object appears in front of or behind other objects in its container
note.gif Focus refers to the current control that receives keystrokes. Only one control on any form can have the focus at any given time. Focus is usually indicated by the position of the edit cursor (for text boxes) or a dotted rectangle around the control (for check boxes, option buttons, and command buttons). square.gif

Responding to Actions with Events
In addition to performing tasks, the objects in your program can respond to actions, whether generated by the users or externally. Responses to actions are handled through the use of events. For example, when users click a command button, the button raises a Click event. Part of the definition of an object is the set of events it can raise and the user actions that trigger them.
Examples of user actions that trigger events are clicking a command button, selecting an item in a list box, or changing the contents of a text box. Events also occur when users exit a form or switch to another form. When an object raises an event, the object executes an event procedure for that specific event. To respond to events, you need to place program code in the appropriate event procedures. For example, in the Loan Calculator example in Chapter 2, you placed code in the Click event procedure of a command button.
Chapter 5, ''Responding to the User with Event Procedures," delves into all the intricacies of events. In that chapter, you will learn how to write code to handle events and how multiple events are related.
How Properties and Methods Are Related
By now, you know that objects have properties to define their appearance, methods that let them perform tasks, and events that let them respond to user actions. You might think that all these things happen independently of one another, but that is not always the case. Sometimes, the properties and methods of an object are related. That is, as you invoke a method of an object, the properties of the object may be changed. Also, most times that you use the methods of an object or change its properties with code, you do so in response to an event.
note.gif Some property changes can trigger events. For example, changing the Height or Width property of a form in code triggers the form's Resize event. square.gif

You can see one example of the interdependence of methods and properties of an object when the Move method is used and the Left and Top properties are set. You can cause an object to

 
< previous page page_51 next page >